//
//  LawListViewController.m
//  DJS
//
//  Created by 浪尖渝力 on 2018/1/5.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "LawListViewController.h"
#import "LawListView.h"
@interface LawListViewController ()
@property(nonatomic,strong)LawListView *aView;
@end

@implementation LawListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title=@"法律咨询";
    _aView=[LawListView new];
    [self.view addSubview:_aView];
    [_aView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.right.mas_equalTo(0);
    }];
    _aView.tableArr1=[NSMutableArray arrayWithCapacity:0];
    _aView.tableArr2=[NSMutableArray arrayWithCapacity:0];
    _aView.tableArr3=[NSMutableArray arrayWithCapacity:0];
    _aView.page1=1;
    _aView.page2=1;
    _aView.page3=1;
    _aView.abc=0;
    [_aView creatView];
    _aView.viewController=self;
    

    
  
}
-(void)viewWillAppear:(BOOL)animated{
    [_aView.tableArr1 removeAllObjects];
    [_aView.tableArr2 removeAllObjects];
    [_aView.tableArr3 removeAllObjects];
    [self loadData];
}


-(void)loadData{
    NSDictionary *userDic = [NSKeyedUnarchiver unarchiveObjectWithFile:_userModelFile];
    NSString *token=[userDic objectForKey:@"token"];
    NSNumber *waiter_id1=[userDic objectForKey:@"waiter_id"];
    NSString *waiter_id=[NSString stringWithFormat:@"%@",waiter_id1];
    NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:waiter_id,@"waiter_id",[NSString stringWithFormat:@"%d",_aView.abc],@"service_status",[NSString stringWithFormat:@"%d",_aView.page1],@"page",@"5",@"pagesize",token,@"token",@"1",@"user_role", nil];
   
    [ZQTools AFNPostDataUrl:@"waiter/consult/consult_list" Dict:dic andTableView:nil andViewController:self andSuccessBlock:^(id responseObject) {
        
        if (_aView.abc==0) {
          
            [_aView.tabelView1.mj_footer endRefreshing];
            [_aView.tabelView1.mj_header endRefreshing];
            NSArray *typeArr=responseObject;
            [_aView.tableArr1 addObjectsFromArray:typeArr];
            [_aView.tabelView1 reloadData];
        }else if (_aView.abc==1) {
            [_aView.tabelView2.mj_footer endRefreshing];
            [_aView.tabelView2.mj_header endRefreshing];
            NSArray *typeArr=responseObject;
 
            [_aView.tableArr2 addObjectsFromArray:typeArr];
            [_aView.tabelView2 reloadData];
    
        }else if (_aView.abc==2) {
            [_aView.tabelView3.mj_footer endRefreshing];
            [_aView.tabelView3.mj_header endRefreshing];
            NSArray *typeArr=responseObject;
            [_aView.tableArr3 addObjectsFromArray:typeArr];
            [_aView.tabelView3 reloadData];
        }

    } anderrorBlock:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
